package com.amigo.online.provider.merchant.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import com.amigo.online.common.core.mybatis.MyMapper;
import com.amigo.online.provider.merchant.model.entity.GoodsCollect;

@Mapper
@Component
public interface GoodsCollectMapper extends MyMapper<GoodsCollect> {


    Integer updateByIdList(@Param("userId") Long userId, @Param("idList") List<Long> idList, @Param("nowTime") Long nowTime);

    @Select("select count(*) from goods_collect_tbl where "
            + " deleted = 0 and user_id = #{userId} and goods_id = #{goodsId}")
    int getCountByUserIdAndGoodsId(@Param("userId") Long userId, @Param("goodsId") Long goodsId);

    @Select("select id from goods_collect_tbl where "
            + " deleted = 0 and user_id = #{userId} and goods_id = #{goodsId} limit 1")
    Long getGoodsCollectIdByUserIdAndGoodsId(@Param("userId") Long userId, @Param("goodsId") Long goodsId);


}